package filters

import (
	"boomlive.com/boomlive-common/configs"
	"github.com/beego/beego/v2/server/web"
	"github.com/beego/beego/v2/server/web/filter/cors"
)

func Cors() web.FilterFunc {

	options := &cors.Options{
		AllowAllOrigins:  false,
		AllowCredentials: false,
		AllowOrigins:     configs.AllowOriginDomain,
		AllowMethods:     configs.AllowOriginMethod,
		AllowHeaders:     configs.AllowOriginHeader,
	}

	return cors.Allow(options)
}
